package com.gejingu.jdbc;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

@SpringJUnitConfig(locations = "classpath:beans.xml")
public class JdbcTemplateTest {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Test
    public void testUpdate(){
        //新增语句
        String insertSql = "insert into person values(null, ?, ?, ?)";
        int insertRows = jdbcTemplate.update(insertSql, "ZhangSan", 18, "男");
        System.out.println(insertRows);
    }
}
